<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        $str = $request->request->get('param','0/0/0');
        $arr = explode('/',$str);
        $arr_con = array();
        $num_ber = $this->mbStrSplit($arr[0]);
        $str_ing = $arr[1];
        $str_ing = $this->mbStrSplit($str_ing);
        if (!empty($str_ing)) {
            for ($i = 0; $i <count($str_ing); $i++) {
                for($t=0;$t<count($num_ber);$t++)
                {
                    $arr_con[$i][$t] = $num_ber[$t].'='.$str_ing[$i].'-'.$arr[2];
                }
            }
        }
        dump($arr_con);
        exit;
    }


    private function mbStrSplit ($string, $len=1) {
        $start = 0;
        $strlen = mb_strlen($string);
        while ($strlen) {
            $array[] = mb_substr($string,$start,$len,"utf8");
            $string = mb_substr($string, $len, $strlen,"utf8");
            $strlen = mb_strlen($string);
        }
        return $array;
    }
}
